<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>浩欣管理平台</title>
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="shortcut icon" href="../static/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="../static/css/font.css">
	<link rel="stylesheet" href="../static/css/weadmin.css">
    <script src="../static/lib/layui/layui.js" charset="utf-8"></script>

</head>
<body class="login-bg">
    
    <div class="login">
        <div class="message">登录</div>
        <div id="darkbannerwrap"></div>
        
        <form method="post" class="layui-form" if = "userInfo">
            <input name="username" placeholder="用户名"  type="text" lay-verify="required" class="layui-input" >
            <hr class="hr15">
            <input name="password" lay-verify="required" placeholder="密码"  type="password" class="layui-input">
            <hr class="hr15">
            <input class="loginin" value="登录" lay-submit lay-filter="login" style="width:100%;" type="submit">
            <hr class="hr20" >
            <div>
            	
            </div>
        </form>
    </div>
	<script src="js/jquery-3.1.1.js"></script>
    <script type="text/javascript">
        
        	layui.extend({
				admin: '{/}../static/js/admin'
			});
            layui.use(['form','admin'], function(){
              var form = layui.form
              	,admin = layui.admin;
              //监听提交
              form.on('submit(login)', function(data){
                // alert(888)
				debugger
				$.post("/user/login",{"data":data.field},function(data1){
					if(data1.retSig == 200){
						debugger
						var sig = data1.httpRet.meta.code;
						if(sig == 1003){
							
			                layer.msg("登录成功！",function(){
			                	
			                	localStorage.setItem('jwt', data1.httpRet.data.jwt);
			                	
			                    location.href='../'
			                    return false;
			                });
						}else{
							
							layer.msg("用户名或密码错误",function(){
								return false;
							});
						}
					}else{
						layer.msg("服务器异常请稍后再试",function(){
							return false;
						});
					}
				})
                return false;
              });
            });   
    </script>  
    <!-- 底部结束 -->
</body>
</html>